#ifndef TRHISTORYQUOTE_H
#define TRHISTORYQUOTE_H

#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QTextCodec>
#include <QObject>
#include <QString>
#include <QDebug>
#include <QUrl>
#include "include/TrImpl.h"
#include "include/TrMdKlineChart.h"

#define SINA_FINANCE_URL_MINI    "http://stock2.finance.sina.com.cn/futures/api/json.php/IndexService.getInnerFuturesMiniKLine{:1}?symbol={:2}"
#define SINA_FINANCE_URL_DAILY   "http://stock2.finance.sina.com.cn/futures/api/json.php/IndexService.getInnerFuturesDailyKLine?symbol={:1}"


class CTrHistoryQuote : public QObject
{
    Q_OBJECT
public:
    explicit CTrHistoryQuote(QObject *parent = nullptr);

public slots:
    void OnDailyFinished();
    void OnMiniFinished();
    void onError(QNetworkReply::NetworkError e);
private:
    QNetworkAccessManager*  m_pManager      =   nullptr;
    QNetworkReply*          m_pDailyReply   =   nullptr;
    QNetworkReply*          m_pMiniReply    =   nullptr;
public:
    void getDailyHistory(QString Instrument);
    void getMiniHistory(QString Instrument);
    CTrImpl*                        m_pTrImpl = nullptr;
};

#endif // TRHISTORYQUOTE_H
